var e = require;
var t = module;
var n = exports;
Object.defineProperty(n, "__esModule", {
    value: !0
});
var o = cc._decorator,
i = o.ccclass,
a = o.property,
r = function(e) {
    __extends(t, e);
    function t() {
        var t = null !== e && e.apply(this, arguments) || this;
        t.adNode = null;
        t.title = null;
        t.desc = null;
        t.iconSprite = null;
        t.mainSprite = null;
        t.insertItem = null;
        t.hasBanner = !1;
        return t
    }
    t.prototype.showInsert = function(e, t) {
        void 0 === t && (t = !1);
        this.insertItem = e;
        this.insertItem.show();
        this.hasBanner = t;
        this.adNode && (this.adNode.active = !0);
        this.title && (SDK.Mgr.Inst.curChannel == SDK.Define.Channel.vivo && "" == this.insertItem.title ? this.insertItem.desc.length > 10 ? this.title.string = this.insertItem.desc.substring(0, 10) + "...": this.title.string = this.insertItem.desc: this.title.string = this.insertItem.title);
        this.desc && (this.desc.string = this.insertItem.desc);
        if (SDK.Mgr.Inst.curChannel == SDK.Define.Channel.vivo) {
            this.iconSprite && (this.insertItem.iconUrl ? SDK.Util.Helper.loadImage(this.iconSprite, this.insertItem.iconUrl, !1) : this.insertItem.imgUrl && SDK.Util.Helper.loadImage(this.iconSprite, this.insertItem.imgUrl, !1));
            if (this.mainSprite) if (this.insertItem.imgUrl) {
                var n = this.insertItem.imgUrl; - 1 == n.indexOf(".jpg") && -1 == n.indexOf(".png") && -1 == n.indexOf(".jpeg") && this.insertItem.iconUrl && (n = this.insertItem.iconUrl);
                SDK.Util.Helper.loadImage(this.mainSprite, n, !1)
            } else this.insertItem.iconUrl && SDK.Util.Helper.loadImage(this.mainSprite, this.insertItem.iconUrl, !1)
        } else {
            this.iconSprite && (this.insertItem.iconUrl ? SDK.Util.Helper.loadImage(this.iconSprite, this.insertItem.iconUrl) : this.insertItem.imgUrl && SDK.Util.Helper.loadImage(this.iconSprite, this.insertItem.imgUrl));
            this.mainSprite && (this.insertItem.imgUrl ? SDK.Util.Helper.loadImage(this.mainSprite, this.insertItem.imgUrl) : this.insertItem.iconUrl && SDK.Util.Helper.loadImage(this.mainSprite, this.insertItem.iconUrl))
        }
    };
    t.prototype.click = function() {
        this.insertItem && this.insertItem.click()
    };
    t.prototype.close = function() {
        this.adNode && (this.adNode.active = !1);
        this.node.destroy()
    };
    __decorate([a(cc.Node)], t.prototype, "adNode", void 0);
    __decorate([a(cc.Label)], t.prototype, "title", void 0);
    __decorate([a(cc.Label)], t.prototype, "desc", void 0);
    __decorate([a(cc.Sprite)], t.prototype, "iconSprite", void 0);
    __decorate([a(cc.Sprite)], t.prototype, "mainSprite", void 0);
    return __decorate([i], t)
} (cc.Component);
n.default = r